CFLAGS = -Wall -fpic -coverage -lm -std=c99

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)

testDrawCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
	gcc -o badTestDrawCard -g  badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

cardTest1: cardTest1.c dominion.o rngs.o
	gcc -o cardTest1 -g cardTest1.c dominion.o rngs.o $(CFLAGS)

cardTest1: cardTest2.c dominion.o rngs.o
	gcc -o cardTest2 -g cardTest1.c dominion.o rngs.o $(CFLAGS)

unitTest1: unitTest1.c dominion.o rngs.o
	gcc -o unitTest1 -g  unitTest1.c dominion.o rngs.o $(CFLAGS)
	  
unitTest2: unitTest2.c dominion.o rngs.o
	gcc -o unitTest2 -g  unitTest2.c dominion.o rngs.o $(CFLAGS)
	  
unitTest3: unitTest3.c dominion.o rngs.o
	gcc -o unitTest3 -g  unitTest3.c dominion.o rngs.o $(CFLAGS)

unitTest4: unitTest4.c dominion.o rngs.o
	gcc -o unitTest4 -g  unitTest4.c dominion.o rngs.o $(CFLAGS) 

testAll: dominion.o testSuite.c
	gcc -o testSuite testSuite.c -g  dominion.o rngs.o $(CFLAGS)


randomtestadventurer: randomtestadventurer.c dominion.o rngs.o
	gcc -o randomtestadventurer -g  randomtestadventurer.c dominion.o rngs.o $(CFLAGS)

rta: randomtestadventurer
	./randomtestadventurer 2 >> randomtestadventurer.out
	gcov dominion.c >> randomtestadventurer.out
	cat dominion.c.gcov>> randomtestadventurer.out

randomtestcard: randomtestcard.c dominion.o rngs.o
	gcc -o randomtestcard -g  randomtestcard.c dominion.o rngs.o $(CFLAGS)

rtc: randomtestcard
	./randomtestcard 2 >> randomtestacard.out
	gcov dominion.c >> randomtestcard.out
	cat dominion.c.gcov>> randomtestcard.out

randtest: randomtestadventurer randomtestcard
	./randomtestadventurer 2 >> randomtests.out
	./randomtestcard 2 >> randomtests.out
	gcov dominion.c >> randomtest.out
	cat dominion.c.gcov>> randomtests.out

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

runtests: testDrawCard unitTest1 unitTest2 unitTest3 
	./testDrawCard &> unittestresult.out
	./unitTest1 >> unittestresult.out
	./unitTest2 >> unittestresult.out
	./unitTest3 >> unittestresult.out
	gcov dominion.c >> unittestresult.out
	cat dominion.c.gcov >> unittestresult.out

player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

all: playdom player testDrawCard testBuyCard badTestDrawCard unitTest2 unitTest3 unitTest1

clean:
	rm -f *.o playdom.exe playdom test.exe test player player.exe testInit testInit.exe *.gcov *.gcda *.gcno *.so
